home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_nub_doorrotate.cog < prev    next >
Text File  |  1999-11-15  |  16KB  |  586 lines

  1. # Jones 3D Cog Script
  2. #
  3. # nub_DoorRotate.cog
  4. #
  5. # [RKD] [TL] et al... [GGJ]
  6. #
  7. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13. message        startup        
  14. message        activated    
  15. message        arrived        
  16. message        touched
  17. message        pulse
  18. message        damaged
  19. message        taken
  20. message        crossed
  21. message        entered
  22. message        exited
  23.  
  24. #.......................... THINGS ........................
  25. thing    door0                                    #door without arm
  26. thing    lever
  27. thing    ledge
  28. thing    arm                mask=0x08    #fake arm (path move object)
  29. thing    camera                        #camera for lever
  30. thing    indy            local        #actor Indy for lever pulling
  31. thing    player            local
  32. thing    Camerapos1                    #camera for door opening
  33. thing    camera2
  34. thing    ghostinv
  35. thing    door1                        #door with arm
  36. thing    horus            linkid=1            
  37. thing    greenlight0
  38. thing    greenlight1
  39. thing    greenlight2
  40. thing    greenlight3
  41. thing    greenlight4
  42. thing    greenlight5
  43. thing    greenlight6
  44. thing    whitelight
  45. thing    ghostindy
  46. thing    armitem                    #mask=0x08    #what you actually pick up
  47. thing    armActor                            #places the arm
  48. thing    hingInvisibox    linkid=1
  49. thing    armCam
  50. thing    armTarg
  51. thing    flyingarm        local
  52. #thing    itemGhost                    #moves the fallen arm to a more natural position.
  53. thing    invisibox        linkid=1    #covers the "handle" that sticks out of the door.
  54. thing    sender            local
  55.  
  56. #.......................... SOUNDS .......................
  57. sound    startdoor
  58. sound    stopdoor
  59. sound    armclick
  60. sound    leversound
  61. sound    leversound2
  62. sound    lighton
  63. sound    voice0=nb02j01a.wav                    local    #Who or what are you.  The doorman I'll bet.  Missing an arm, though.
  64. sound    voice1=nb02j02.wav                    local    #This thing's arm is missing.
  65. sound    lockedwav=inxj096.wav                local    #I can't open it.
  66. sound    noarmwav=inxj146.wav                local    #Hmmmm.
  67. sound    openwav=inxj104.wav                    local    #Open sesame.
  68. sound    whipwav=inxj112.wav                    local    #That ought to do it.
  69. sound    pickupwav=inxj153.wav                local    #An interesting gadget.
  70. sound    elevMus=mus_pyr_pyramid1.wav        local
  71. sound    sesameMus=mus_nub_annubisarm.wav    local
  72. sound    newTech=nb02j03.wav                    local    #This place is strange.  And I used to think I knew a lot about archeology.
  73. sound    wrongSpot0=INXJ224.wav                local    #I need to find a better spot.
  74. sound    wrongSpot1=INXJ219.wav                local    #I'm not lined up right
  75. #sound    wrongSpot2=INXJ090.wav                local    #That didn't work.  I'm doing something wrong    #Removed because of tester confusion.
  76. sound    armFallSnd=olv_rockhead_hitearth_c.wav    local
  77.  
  78. #.......................... TEMPLATES ....................
  79. template    arminv=anubisarm                local #type of key from template
  80. template    actorindy
  81.  
  82. #.......................... KEYFRAMES ....................
  83. keyframe    in_pull=in_pull_lever.key        local
  84. keyframe    lever_pull=gen_lever_pull.key    local
  85. keyframe    in_one
  86. keyframe    in_hat
  87. keyframe    reachHigh=in_reach_high.key        local
  88.  
  89. #.......................... MODELS .......................
  90. model    whipHand=weap_whip.3do               local
  91.  
  92. #.................... SECTORS & SURFACES .................
  93. sector    doorSector
  94. sector    doorSector2
  95. surface    adjoin0
  96. surface    positionSurf
  97.  
  98. #........................... COGS ........................
  99. cog        commie0
  100. cog        commie1
  101. cog        commie2
  102. cog        hint
  103.  
  104. #......................... VARIABLES .....................
  105. int        open=0            local
  106. int        placed=0        local
  107. int        curCam            local
  108. int        begun=0            local
  109. int        hit=0            local
  110. int        hit1=0            local
  111. int        talkstarted=0    local
  112. int        lockeddone=0    local
  113. int        passed=0        local
  114. int        ponderScene=0    local
  115. int        positioned=0    local
  116.  
  117. flex    doorspeed=1.0
  118. flex    cameraspeed=1.0
  119. flex    rvalmax
  120. flex    gvalmax
  121. flex    bvalmax
  122. flex    rvalmin
  123. flex    gvalmin
  124. flex    bvalmin
  125. flex    lituptime
  126. flex    playery            local
  127. flex    playerx            local
  128.  
  129. vector    maxlite            local
  130. vector    minlite            local
  131. vector    playervec        local
  132. vector    v_targetpos        local
  133.  
  134. end
  135.  
  136. # ========================================================================================
  137. code
  138.  
  139. startup:
  140.  
  141. Sleep(0.01);
  142. Print("Setting adjoin in startup");
  143. SetSectorAdjoins(doorSector, 0);
  144. PrintInt(doorsector);
  145. SetThingFlags(door1, 0x80000);
  146. SetThingFlags(armitem, 0x80000);
  147. #Dynamic light stuff
  148. maxlite = VectorSet(rvalmax, gvalmax, bvalmax);
  149. minlite = VectorSet(rvalmin, gvalmin, bvalmin);
  150. AttachThingToThing(invisibox, door0);
  151. Print("Attached in startup");
  152. PrintInt(invisibox);
  153. PrintInt(door0);
  154.  
  155. player = GetLocalPlayerThing();
  156.  
  157. return;
  158.  
  159. # ........................................................................................
  160. crossed:
  161.  
  162. if (passed == 1) return;
  163.  
  164. if (GetSenderRef() == adjoin0)
  165. {
  166.     passed = 1;
  167.     Rotate(door1, -110, 1, doorspeed);
  168.  
  169.     PlaySoundLocal(elevMus, 1.0, 0, 0x0000, 0);
  170.  
  171.     SetThingLight(greenlight0, minlite, 0.4, lituptime);
  172.     SetThingLight(greenlight1, minlite, 0.4, lituptime);
  173.     SetThingLight(greenlight2, minlite, 0.4, lituptime);
  174.     SetThingLight(greenlight3, minlite, 0.4, lituptime);
  175.     SetThingLight(greenlight4, minlite, 0.4, lituptime);
  176.     SetThingLight(greenlight5, minlite, 0.4, lituptime);
  177.     SetThingLight(greenlight6, minlite, 0.4, lituptime);
  178.  
  179.     PlaySoundLocal(startdoor, 1.0, 0, 0x0000, 0);
  180.     Sleep(doorspeed);
  181.     SetSectorAdjoins(doorSector2, 0);
  182.     
  183.     Sleep(0.5);
  184.     PlayVoice(player, newTech, 1.0, 0);
  185. }
  186.  
  187. return;
  188.  
  189. # ........................................................................................
  190. damaged:
  191.  
  192. if (hit == 1) return;
  193.  
  194. sender = GetSenderRef();
  195. if (sender == arm)
  196. {
  197.     # Easy outs...
  198.     if (GetParam(1) != 0x10) return;
  199.     if (GetCurFrame(arm) == 0) return;
  200.  
  201.     hit = 1;
  202.     StartCutscene(0);
  203.  
  204.     SetCameraFocus(2, armCam);
  205.     SetCameraSecondaryFocus(2, armTarg);
  206.     SetCurrentCamera(2);
  207.     SetCameraFOV(100, 0, 0.0);
  208.  
  209.     flyingarm = CreateThing(arminv, ghostinv);
  210.     CaptureThing(flyingArm);
  211.     
  212.     
  213.     SetThingMoveSize(flyingarm, 0.04);
  214.     DestroyThing(arm);
  215.     ApplyForce(flyingarm, '-100.0 400.0 100.0');
  216.     Sleep(1.0);
  217.     PlayVoice(player, whipwav, 1.0, 0);
  218.     Sleep(0.1);
  219.     SetThingVel(flyingarm, '0 0 0');
  220.     SetThingMass(flyingarm, 0.0);
  221.     PlaySoundThing(armFallSnd, armitem, 1.0, -1.0, -1.0, 0x0);
  222.     Sleep(2.0);
  223.     #CopyOrientAndPos(itemGhost, armitem);
  224.     
  225.     ClearThingFlags(armitem, 0x80000);
  226.     SetThingFlags(flyingArm, 0x80000);
  227.  
  228.     #Sleep(1.0);
  229.  
  230.     SetCurrentCamera(1);
  231.     ResetCameraFOV(0, 0.0);
  232.     
  233.     #Clear flags that Randy C. Tudor sets in whip cog.
  234.     ClearActorFlags(player, 0x200000);
  235.     EndCutscene();
  236.     
  237. }
  238.  
  239. return;
  240.  
  241. # ........................................................................................
  242. touched:
  243.  
  244. if (ponderScene == 1) return;
  245. #Code checks that Indy is facing statue... see below.
  246. playervec = GetThingLVec(player);
  247. playery = VectorY(playervec);
  248. playerx = VectorX(playervec);
  249.  
  250. sender = GetSenderRef();
  251. if ((sender == horus) && ((playerx > 0) && ((playery > -0.7) && (playery < 0.7))))        #|| (GetSenderRef() == talkface2))
  252. {
  253.     if (talkstarted == 1) return;
  254.     talkstarted = 1;
  255.     ponderScene = 1;
  256.  
  257.     MakeMeStop();
  258.     DeselectWeaponWait(player);                     # stow any weapon or lighter
  259.     StartCutscene(1);
  260.     indy = CreateThing(actorindy, player);
  261.     CaptureThing(indy);
  262.     CopyPlayerHolsters(player, indy);                 # make sure actor has matching props
  263.     SetThingFlags(player, 0x80000);
  264.     ClearThingFlags(indy, 0x80000);
  265.     SetCurrentCamera(0);
  266.     SetCameraFocus(0, camera2);
  267.     SetCameraFOV(90, 0, 0.0);
  268.  
  269.     PlayVoice(indy, voice0, 1.0, 0);
  270.     PlayKey(indy, in_one, 4, 0x12, 1);
  271.     Sleep(2.0);
  272.     SetCurrentCamera(1);
  273.     SetCameraFocus(0, player);
  274.     DestroyThing(indy);         
  275.     ClearThingFlags(player, 0x80000);
  276.     ClearActorFlags(player, 0x200000);
  277.     EndCutscene();
  278. }
  279.  
  280. return;
  281.  
  282. # ........................................................................................
  283. activated:
  284. Print("activated");
  285.  
  286. sender = GetSenderRef();
  287.  
  288. if ((GetCurItem(player) == 52) && (GetSenderID() != 1))
  289. {
  290.     PlayVoice(player, wrongSpot0[randbetween(0, 1)], 1.0, 1);
  291.     return;
  292. }
  293.  
  294. if (sender == armitem)
  295. {
  296.     Print("activated armitem");
  297.     Sleep(0.5);
  298.     #PlayVoice(player, pickupwav, 1.0, 0);            #handled by Randy
  299.     SendMessage(commie0, user0);
  300.     SendMessage(commie1, user0);
  301.     SendMessage(commie2, user0);
  302.     SendMessage(hint, user0);
  303. }
  304.  
  305. if ((begun) == 1) return;
  306. if (lockeddone == 1) return;
  307.  
  308. if ((sender == door0) && (open == 0))
  309. {
  310.     lockeddone = 1;
  311.     PlayMode(player, 60, 0);        
  312.     PlayVoice(player, lockedwav, 1.0, 1);
  313. }
  314. else if ((sender == door1) && (open == 0))
  315. {
  316.     lockeddone = 1;
  317.     PlayMode(player, 60, 0);        
  318.     PlayVoice(player, lockedwav, 1.0, 1);
  319. }
  320. lockeddone = 0;
  321.  
  322. curCam = GetCurrentCamera();
  323.  
  324. if (sender == lever)
  325. {
  326.     if (placed == 0)
  327.     {
  328.         begun = 1;
  329.  
  330.         MakeMeStop();
  331.         DeselectWeaponWait(player);                     # stow any weapon or lighter
  332.  
  333.         #switch player with actor indy and show lever-pulling cutscene. (no door)
  334.         StartCutscene(1);
  335.         
  336.         indy = CreateThing(actorindy, ghostindy);
  337.         CaptureThing(indy);
  338.         CopyPlayerHolsters(player, indy);                 # make sure actor has matching props
  339.         
  340.         SetCameraLookInterp(2, 0);
  341.         SetCameraPOSInterp(2, 0);
  342.  
  343.         SetCameraFocus(2, camera);
  344.         SetCameraSecondaryFocus(2, lever);
  345.         SetCurrentCamera(2);
  346.         SetCameraFOV(90, 0, 0.0);
  347.         
  348.         ClearThingFlags(indy, 0x80000);
  349.         SetThingFlags(player, 0x80000);
  350.  
  351.         PlayKey(lever, lever_pull, 4, 0x12, 0);
  352.         PlayKey(indy, in_pull, 4, 0x12, 0);
  353.         Sleep(1.2);
  354.         PlaySoundLocal(leversound, 1.0, 0, 0x0000, 0);
  355.         Sleep(1.4);
  356.         PlaySoundLocal(leversound2, 1.0, 0, 0x0000, 1);
  357.         Sleep(0.3);
  358.         
  359.         SetCameraPosition(1, GetThingPos(camera));
  360.         SetCurrentCamera(1);
  361.         
  362.         #SetCameraFocus(0, player);
  363.         DestroyThing(indy);
  364.         ClearThingFlags(player, 0x80000);
  365.         ClearActorFlags(player, 0x200000);
  366.         PlayVoice(player, noarmwav, 1.0, 1);
  367.  
  368.         begun = 0;
  369.         EndCutscene();
  370.     }
  371.     else if    (open == 0)
  372.     {
  373.         StartCutscene(1);
  374.         begun = 1;
  375.         #switch player with actor indy and show lever-pulling cutscene.
  376.         DeselectWeaponWait(player);                     # stow any weapon or lighter
  377.         SetThingFlags(player, 0x80000);
  378.         SetActorFlags(player, 0x200000);
  379.         indy = CreateThing(actorindy, ghostindy);
  380.         CaptureThing(indy);
  381.         CopyPlayerHolsters(player, indy);                 # make sure actor has matching props
  382.         SetCurrentCamera(0);
  383.         SetCameraFocus(0, camera);
  384.         SetCameraFOV(90, 0, 0.0);
  385.         ClearThingFlags(indy, 0x80000);
  386.         PlayKey(lever, lever_pull, 4, 0x12, 0);
  387.         PlayKey(indy, in_pull, 4, 0x12, 0);
  388.         Sleep(1.2);
  389.         PlaySoundLocal(leversound, 1.0, 0, 0x0000, 0);
  390.         Sleep(1.4);
  391.         PlaySoundLocal(leversound2, 1.0, 0, 0x0000, 1);
  392.         Sleep(0.3);
  393.         #show Aetherium Door opening in it's own cutscene and play sound then return to player.
  394.  
  395.         SetSectorAdjoins(doorSector, 1);
  396.         SetCurrentCamera(0);
  397.         SetCameraFocus(0, Camerapos1);
  398.         SetCameraFOV(90, 0, 0.0);
  399.         AiSetLookThing(indy, door1);
  400.         PlayKey(indy, in_hat, 4, 0x12, 0);
  401.         PlayVoice(indy, openwav, 1.0, 1);
  402.         PlaySoundLocal(sesameMus, 1.0, 0, 0x0000, 0);
  403.  
  404.         SetThingLight(greenlight0, maxlite, 0.4, lituptime);
  405.         SetThingLight(greenlight1, maxlite, 0.4, lituptime);
  406.         SetThingLight(greenlight2, maxlite, 0.4, lituptime);
  407.         SetThingLight(greenlight3, maxlite, 0.4, lituptime);
  408.         SetThingLight(greenlight4, maxlite, 0.4, lituptime);
  409.         SetThingLight(greenlight5, maxlite, 0.4, lituptime);
  410.         SetThingLight(greenlight6, maxlite, 0.4, lituptime);
  411.         DestroyThing(whitelight);
  412.  
  413.         PlaySoundLocal(lighton, 1.0, 0, 0x0000, 1);
  414.         PlaySoundLocal(startdoor, 1.0, 0, 0x0000, 0);
  415.         Rotate(door1, 110, 1, doorspeed);
  416.         MoveToFrame(Camerapos1, 1, cameraspeed);
  417.         WaitForStop(Camerapos1);
  418.         Sleep(1.0);
  419.  
  420.         #AiSetLookThing(indy, lever);
  421.         Sleep(1.5);
  422.         
  423.         #SetCameraFocus(0, player);
  424.         Movetoframe(Camerapos1, 0, 10);
  425.         CopyOrientandPos(indy, player);
  426.         DestroyThing(indy);
  427.         ClearThingFlags(player, 0x80000);
  428.         ClearActorFlags(player, 0x200000);
  429.  
  430.         # revert cam
  431.         v_targetpos = VectorAdd(VectorTransformToOrient(player, '-0.2 -0.05 0.0'), GetThingPos(player));    
  432.         SetCameraPosition(1, v_targetpos);
  433.         
  434.         SetCurrentCamera(1);
  435.  
  436.         EndCutscene();
  437.         begun = 0;
  438.     }
  439.     else
  440.     {
  441.         StartCutscene(1);
  442.         begun = 1;
  443.         #same as above.
  444.         DeselectWeaponWait(player);                     # stow any weapon or lighter
  445.         SetThingFlags(player, 0x80000);
  446.         SetActorFlags(player, 0x200000);
  447.         indy = CreateThing(actorindy, ghostindy);
  448.         CaptureThing(indy);
  449.         CopyPlayerHolsters(player, indy);                 # make sure actor has matching props
  450.         SetCurrentCamera(0);
  451.         SetCameraFocus(0, camera);
  452.         SetCameraFOV(90, 0, 0.0);
  453.         ClearThingFlags(indy, 0x80000);
  454.         PlayKey(lever, lever_pull, 4, 0x12, 0);
  455.         PlayKey(indy, in_pull, 4, 0x12, 0);
  456.         Sleep(1.2);
  457.         PlaySoundLocal(leversound, 1.0, 0, 0x0000, 0);
  458.         Sleep(1.4);
  459.         PlaySoundLocal(leversound2, 1.0, 0, 0x0000, 1);
  460.         Sleep(0.3);
  461.         #same as above but closes door.
  462.         Rotate(door1, -110, 1, doorspeed);
  463.         SetCurrentCamera(0);
  464.         SetCameraFocus(0, Camerapos1);
  465.         SetCameraFOV(90, 0, 0.0);
  466.  
  467.         SetThingLight(greenlight0, minlite, 0.4, lituptime);
  468.         SetThingLight(greenlight1, minlite, 0.4, lituptime);
  469.         SetThingLight(greenlight2, minlite, 0.4, lituptime);
  470.         SetThingLight(greenlight3, minlite, 0.4, lituptime);
  471.         SetThingLight(greenlight4, minlite, 0.4, lituptime);
  472.         SetThingLight(greenlight5, minlite, 0.4, lituptime);
  473.         SetThingLight(greenlight6, minlite, 0.4, lituptime);
  474.  
  475.         PlaySoundLocal(startdoor, 1.0, 0, 0x0000, 0);
  476.         MoveToFrame(Camerapos1, 1, cameraspeed);
  477.         WaitForStop(Camerapos1);
  478.         Sleep(1.5);
  479.         SetCurrentCamera(1);
  480.         Movetoframe(Camerapos1, 0, 10);
  481.         SetThingFlags(indy, 0x80000);
  482.         DestroyThing(indy);
  483.         ClearThingFlags(player, 0x80000);
  484.         ClearActorFlags(player, 0x200000);
  485.         begun = 0;
  486.         SetSectorAdjoins(doorSector, 0);
  487.         EndCutscene();
  488.     }
  489. }
  490. if ((GetSenderID() == 1) && (positioned == 1))            #was "else if"
  491. {
  492.     if (hit1 == 1) return;
  493.  
  494.     #if Indy has the Anubis Arm key...then switch doors and delete arm from inventory.
  495.     if (GetCurItem(player) == 52)
  496.     {
  497.         hit1 = 1;
  498.         ponderScene = 1;
  499.         
  500.         MakeMeStop();
  501.         DeselectWeaponWait(player);                     # stow any weapon or lighter
  502.         StartCutscene(1);
  503.         SetThingFlags(player, 0x80000);
  504.         CopyPlayerHolsters(player, armActor);                 # make sure actor has matching props
  505.         ClearThingFlags(armActor, 0x80000);
  506.         
  507.         SetCameraFocus(2, camera2);
  508.         SetCameraSecondaryFocus(2, hingInvisibox);
  509.         SetCurrentCamera(2);
  510.         SetCameraFOV(90, 0, 0.0);
  511.         PlayKey(armActor, reachHigh, 4, 0x12, 0);
  512.         Sleep(0.5);
  513.         
  514.         AttachThingToThing(invisibox, door1);
  515.         DestroyThing(door0);
  516.         ClearThingFlags(door1, 0x80000);
  517.         PlaySoundLocal(armclick, 1.0, 0, 0x0000, 0);
  518.         ChangeInv(player, 52, -1);
  519.         placed = 1;
  520.         Sleep(0.5);
  521.         ClearThingFlags(player, 0x80000);
  522.         ClearActorFlags(player, 0x200000);
  523.         SetThingFlags(armActor, 0x80000);
  524.         SetCurrentCamera(1);
  525.         SendMessage(hint, user1);
  526.         EndCutscene();
  527.     }
  528.     else if ((placed == 0) && (ponderScene == 1))
  529.     {
  530.         hit1 = 1;
  531.         PlayVoice(player, voice1, 1.0, 1);
  532.     }
  533.     hit1 = 0;
  534.     return;
  535. }
  536.  
  537. return;
  538.  
  539. # ........................................................................................
  540. arrived:
  541.  
  542. if (GetSenderRef() == door1) 
  543. {
  544.     open = 1 - open;
  545.     PlaySoundLocal(stopdoor, 1.0, 0, 0x0000, 0);
  546. }
  547.  
  548. return;
  549.  
  550. # ........................................................................................
  551. taken:
  552. PRINT("taken");
  553.  
  554. #if (GetSenderRef() == armitem)
  555. #    {
  556. #    Sleep(0.5);
  557. #    PlayVoice(player, pickupwav, 1.0, 0);
  558. #    SendMessage(commie, user0);
  559. #    }
  560.  
  561. return;
  562.  
  563. # ........................................................................................
  564. entered:
  565.  
  566. if (GetSenderRef() == positionSurf)
  567. {
  568.     positioned = 1;
  569.     return;
  570. }
  571. return;
  572.  
  573. # ........................................................................................
  574. exited:
  575.  
  576. if (GetSenderRef() == positionSurf)
  577. {
  578.     positioned = 0;
  579.     return;
  580. }
  581. return;
  582.  
  583. # ........................................................................................
  584. end
  585.  
  586.